<template>
  <div
    class="portal-page-container"
    v-loading="loading"
    element-loading-text="数据加载中..."
  >
    <visual-page v-if="!loading" :pageInfo="pageInfo" />
  </div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import { useRoute } from 'vue-router';
import VisualPage from "@/visual/view/page.vue";
import { getPage } from '@/utils/codeless';

const route = useRoute();
const loading = ref(true);
const pageInfo = ref({});
const pageId = route.params?.pageId;

onMounted(async() => {
  loading.value = true;
  pageInfo.value = await getPage(pageId);
  loading.value = false;
});
</script>

<style>
#app {
  background: #eee;
  box-sizing: border-box;
}
</style>
<style scoped>
.portal-page-container {
  box-sizing: border-box;
}
</style>